* cache standalone messages fetched from DB on memcached
authorDomas Mituzas <midom@users.mediawiki.org>
Tue, 5 Oct 2004 11:18:43 +0000 (11:18 +0000)
committerDomas Mituzas <midom@users.mediawiki.org>
Tue, 5 Oct 2004 11:18:43 +0000 (11:18 +0000)
*                                   from DB/memcached on MC:mCache

includes/MessageCache.php

index fd6ae56..9b4c3d7 100755 (executable)
@@ -232,6 +232,13 @@ class MessageCache
                                $message = $this->mCache[$title];
                        }
 
+                       if ( !$message && $this->mUseCache ) {
+                               $message = $this->mMemc->get($this->mMemcKey.':'.$title);
+                               if ($message) {
+                                       $this->mCache[$title]=$message;
+                               }
+                       }
+
                        # If it wasn't in the cache, load each message from the DB individually
                        if ( !$message ) {
                                $dbr =& wfGetDB( DB_SLAVE );
@@ -240,6 +247,13 @@ class MessageCache
                                  'MessageCache::get' );
                                if ( $result ) {
                                        $message = $result->cur_text;
+                                       if ($this->mUseCache) {
+                                               $this->mCache[$title]=$message;
+                                               /* individual messages may be often 
+                                                  recached until proper purge code exists 
+                                               */
+                                               $this->mMemc->set($this->mMemcKey.':'.$title,$message,300);
+                                       }
                                }
                        }
                }